import request from '@/utils/request'
import type { Account, ResponseData } from './type'

enum API {
  LOGIN_URL = '/login',
  USERINFO_URL = '/getUserInfo',
  LOGOUT_URL = '/logout',
  USERINFO_EDIT_URL = '/updateUserInfo',
  PASSWORD_EDIT_URL = '/updatePassword',
  HIKSSO_URL = 'getHikSSO',
}

export function login(data: Account) {
  return request.post<any, ResponseData>(API.LOGIN_URL, data)
}

export function userInfo() {
  return request.get<any, ResponseData>(API.USERINFO_URL)
}

export function logout() {
  return request.post<any, ResponseData>(API.LOGOUT_URL)
}

export function getHikSSO() {
  return request.get<any, ResponseData>(API.HIKSSO_URL)
}

export function userInfoEdit(data: any) {
  return request.put<any, ResponseData>(API.USERINFO_EDIT_URL, data)
}

export function passwordEdit(data: any) {
  return request.put<any, ResponseData>(API.PASSWORD_EDIT_URL, data)
}
